|
|
 |
|
|
|
|
' Make room for the output pixels. ReDim new_pixels(0 To UBound(pic0_pixels, 1), _
0 To UBound(pic0_pixels, 2))
' Build the frames. For i = 1 To num_frames
lblFrameNumber.Caption = Format$(i)
DoEvents
f1 = i / num_frames
f0 = 1 - f1
For X = 0 To picCanvas(0).ScaleWidth - 1
For Y = 0 To picCanvas(0).ScaleHeight - 1
With new_pixels(X, Y)
.rgbRed = _
f0 * pic0_pixels(X, Y).rgbRed + _
f1 * pic1_pixels(X, Y).rgbRed
.rgbGreen = _
f0 * pic0_pixels(X, Y).rgbGreen + _
f1 * pic1_pixels(X, Y).rgbGreen
.rgbBlue = _
f0 * pic0_pixels(X, Y).rgbBlue + _
f1 * pic1_pixels(X, Y).rgbBlue
End With
Next Y
Next X
' Update the image. SetBitmapPixels picCanvas(0), bits_per_pixel, _
new_pixels
picCanvas(0).Picture = picCanvas(0).Image
' Save the results. SavePicture picCanvas(0).Picture, _
base_name & Format$(i) & ".bmp"
Next i
' Restore the original image. SetBitmapPixels picCanvas(0), bits_per_pixel, pic0_pixels
picCanvas(0).Picture = picCanvas(0).Image
lblFrameNumber.Caption = ""
End Sub |
|
|
|
|
|
|
|
|
The program uses the GetBitmapPixels and SetBitmapPixels functions described in Chapter 3, Advanced Color, to get reasonable performance. Unfortunately, the program is still not fast enough to build the images in real time. You will need to generate the frames ahead of time and store them for later use. |
|
|
|
|
|
|
|
|
In a fade, the old image grows gradually darker until it is black. This is just a special case of a dissolve in which the old image dissolves into a black one. Often a fade (fade out) is followed by a reversed fade (fade in) to present a new image. |
|
|
|
|
|